$(function () {
    //初始加载
    data = { 'id': $('.js-only').attr('id')};
    result = apiAjax0(data, apiUrlGetProject);
    if (result) {
        result = result.data;
        $('.js-project-name').val(result.project.name);
        $('.js-project-area').val(result.project.area);
        $('.js-project-image').val(result.project.image);
        $('.js-project-briefintroduce').val(result.project.brief_introduce);
        $('.js-project-introduce').val(result.project.introduce);
        $('.js-project-showstate').val(result.project.show_state);
    }

    //提交按钮
    $('.js-btn-submit').click(function () {
        data = {
            'UUID': $.cookie('UUID'),
            'id': $('.js-only').attr('id'),
            'name': $('.js-project-name').val(),
            'image': $('.js-project-image').val(),
            'show_state': $('.js-project-showstate').val(),
            'brief_introduce': $('.js-project-briefintroduce').val(),
            'introduce': $('.js-project-introduce').val()
        };
        console.log(data);
        result = apiAjax0(data, apiUrlProjectPutProject, 'PUT');//提交数据
        if (result) {
            //成功
            mdui.snackbar({
                message: '编辑成功!正在跳转',
                position: 'left-top'
            });
            //附加功能
            window.location.replace('/v/user/project');
            return;
        }

    })

})